<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>

        * {
            padding: 0;
            margin: 0;
        }

        .wrapper {
            resize: both;
            overflow: hidden;
            width: 300px;
            height: 300px;
            border: 1px solid black;
            display: flex;
            flex-direction: column;
            flex-wrap: nowrap;
            align-items: stretch;
            /* 这里拉伸的宽，因为主轴方向变化了 */
        }
        .header, .footer {
            flex: 0 0 20%;
            /* height: 20%; */
            /* 当主轴方向为column时，flex-basis默认会取height的值 */
            border: 1px solid green;
            box-sizing: border-box;
        }

        .contain {
            flex: 1 0 auto;
            display: flex;
            /* 这块子元素接着flex布局 */
        }

        .left, .right {
            flex: 0 0 20%;
            box-sizing: border-box;
            border: 1px solid green;
        }
        .center {
            flex: 1 1 auto;
        }



    </style>
</head>
<body>
    <div class="wrapper">
        <div class="header">header</div>
        <div class="contain">
            <div class="left">left</div>
            <div class="center">center</div>
            <div class="right">right</div>
        </div>
        <div class="footer">footer</div>
    </div>
</body>
</html>